import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/view/layout/index.vue'
import serviceRouter from './modules/service'
import companyRouter from './modules/company'
import memberRouter from './modules/member'
import customRouter from './modules/custom'

export const menus = [
  {
    path: 'index',
    name: 'Index',
    hidden:false,
    meta: {title: '首页',icon: 'odometer'},
    component: () => import('@/view/dashboard/index.vue'),
  },
  ...serviceRouter,
  ...companyRouter,
  ...memberRouter,
  ...customRouter
]

export const routes = [
  {
    path: "/",
    name: "layout",
    meta: {title: "layout",icon: 'odometer'},
    hidden:false,
    redirect: '/index',
    component: Layout,
    children:menus
  },
  // {
  //   path: '/init',
  //   name: 'Init',
  //   hidden:true,
  //   component: () => import('@/view/init/index.vue')
  // },
  {
    path: '/login',
    name: 'Login',
    hidden:true,
    component: () => import('@/view/login/index.vue'),
    meta: { title: '登录' }
  },
  { 
    path: '/404',
    name: '404',
    hidden:true,
    component: () => import('@/view/error/index.vue'),
    meta: { title: '404' }
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
